'''
Created on 25/04/2011

@author: ivan
'''
from threading import Thread
from events import Event


class MooHandlerEvent(Thread, Event):
    '''
    classdocs
    '''

    def __init__(self, name, evento):
        '''
        Constructor
        '''
        Thread.__init__(self)
        Event.__init__(self, name)
        
        self.name = name
        self.evento = evento
        
        self.setDaemon(True)
        
    def run(self):
        print self.getName(), 'esperando al evento'
        self.evento.wait()
        print self.getName(), 'termina la espera'
    
    def activate_me(self):
        self.evento.set()